﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Itasa.API;

namespace Itasa
{
    internal class Calendar
    {
        private List<Episode_Date> Episodes;
        private ITASA_user user;

        internal Calendar(ITASA_user user)
        {
            this.user = user;
            this.Episodes = new List<Episode_Date>();
            //update();
        }

        internal void update()
        {
            Episodes.Clear();
            foreach (Episode e in Params.Episodes)
            {
                Episode_Date ed = new Episode_Date(e.Date);
                if (Episodes.Contains(ed)) ed = Episodes[Episodes.IndexOf(ed)];
                else Episodes.Add(ed);
                ed.addEpisode(e);
            }
            Episodes.Sort();
        }

        internal List<Episode_Date> getList()
        {
            return Episodes;
        }
    }
}
